package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import util.enumeration.Language;

/**
 *
 * @author WenYong
 */
@Entity(name="UnstructuredContentPage")
public class UnstructuredContentPageEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long unstructuredContentPageId;
    private int templateNo;
    private Language lang;
    @OneToMany(cascade = {CascadeType.ALL})
    private List<UnstructuredContentPanelEntity> unstructuredContentPanel = new ArrayList<UnstructuredContentPanelEntity>();
    
    public UnstructuredContentPageEntity() 
    {
        
    }
     public UnstructuredContentPageEntity(int templateNo,Language lang, List<UnstructuredContentPanelEntity> unstructuredContentPanel) 
     {
         this.templateNo = templateNo;
         this.lang = lang;
         this.unstructuredContentPanel = unstructuredContentPanel;
     }
    public Long getUnstructuredContentPageId() {
        return unstructuredContentPageId;
    }

    public void setUnstructuredContentPageId(Long unstructuredContentPageId) {
        this.unstructuredContentPageId = unstructuredContentPageId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (unstructuredContentPageId != null ? unstructuredContentPageId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the unstructuredContentPageId fields are not set
        if (!(object instanceof UnstructuredContentPageEntity)) {
            return false;
        }
        UnstructuredContentPageEntity other = (UnstructuredContentPageEntity) object;
        if ((this.unstructuredContentPageId == null && other.unstructuredContentPageId != null) || (this.unstructuredContentPageId != null && !this.unstructuredContentPageId.equals(other.unstructuredContentPageId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.UnstructuredContentPage[ id=" + unstructuredContentPageId + " ]";
    }

    public List<UnstructuredContentPanelEntity> getUnstructuredContentPanel() {
        return unstructuredContentPanel;
    }

    public void setUnstructuredContentPanel(List<UnstructuredContentPanelEntity> unstructuredContentPanel) {
        this.unstructuredContentPanel = unstructuredContentPanel;
    }

    public int getTemplateNo() {
        return templateNo;
    }

    public void setTemplateNo(int templateNo) {
        this.templateNo = templateNo;
    }
    public Language getLang() {
        return lang;
    }
    public void setLang(Language lang) {
        this.lang = lang;
    }
    
}
